<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<jsp:include page="/common/include_js.jsp" />
<script type="text/javascript" src="<%=request.getContextPath() %>/js/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/bsn.AutoSuggest_2.1.3.js"></script>
<link rel="stylesheet" type="text/css" media="screen" href="<%=request.getContextPath() %>/css/autosuggest_inquisitor.css" />
</head>
<body>

<form id="loginForm" action="<%=request.getContextPath() %>/front/frontLogin.action" method="post">
<input type="text" id="username" name="username" value="a@a.a" />
<input type="text" id="password" name="password" value="111111" />
<input type="button" id="subBtn" value="submit" onclick="javascript:checkLogin();">
</form>
<br/><br/>

<input type="text" id="testid" value="" style="font-size: 10px; width: 20px;" />
<input style="width: 200px" type="text" id="testinput" value="" />
<br/><br/>

<input class="Wdate" type="text" onclick="WdatePicker({isShowClear:false,readOnly:true});"/>
<br/><br/>

<iframe src="http://m.weather.com.cn/m/pn6/weather.htm?id=101020100T" width="490" height="50" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no"></iframe>
<br/><br/>

<script type='text/javascript' src='<%=request.getContextPath() %>/dwr/interface/frontLoginAction.js'></script>
<script type="text/javascript">
	var reg=/\s/g;
	var checkLogin=function(){
		var username=document.getElementById('username');
		var password=document.getElementById('password');
		username.value=username.value.replace(reg,'');
		password.value=password.value.replace(reg,'');
		
		var u=username.value;
		var p=password.value;
		
		if(u&&p){
			document.getElementById('subBtn').style.display='none';
			frontLoginAction.checkLogin(u,p,function(res){
				if(res){
					document.getElementById('loginForm').submit();
				}else{
					document.getElementById('subBtn').style.display='block';
					alert('wrong username or password');
					username.focus();
					username.select();
				}
			});
		}
	}
	
	var options = {
		script:'<%=request.getContextPath() %>/json/query!city.action?',
		varname:'k',
		meth:'post',
		json:true,
		shownoresults:false,
		maxresults:6,
		clickOneResult:1,
		callback: function (obj) { document.getElementById('testid').value = obj.id; }
	};
	var as_json = new bsn.AutoSuggest('testinput', options);
</script>
</body>
</html>